package cn.ydw.community.dao;

import cn.ydw.community.entity.DiscussPost;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author dw
 * @since 2020-10-18
 */
@Mapper
public interface DiscussPostDao extends BaseMapper<DiscussPost> {
    List<DiscussPost> selectPageVO(Page<?> page, @Param("userId")Integer userId);
    List<DiscussPost> selectDiscussPosts(Page<?> page);
    int updateDiscussPostCommentCount(@Param("id") Integer id, @Param("commentCount") Integer commentCount);
    /**
     * 加精 或 拉黑
     */
    int updateDiscussionByStatus(Integer postId, Integer status);
    /**
     * 置顶
     */
    int updateDiscussionByType(Integer postId, Integer type);

    /**
     * 根据学校名查询对应的帖子
     */
    List<DiscussPost> selectDiscussPostByType(Page<?> page,@Param("userType") Integer userType);

    int updateScore(@Param("postId") Integer postId,@Param("score") double score);

//    List<DiscussPost> selectPostByUserId();

}
